package RPGame;

import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.SpriteSheet;
import org.newdawn.slick.Animation;

public class EntityActor extends Entity {

	protected String id;
	protected String name;
	protected SpriteSheet spriteSheet;
	protected Animation animation[];
	protected ActorState action;
	protected Direction direction;
	
	public EntityActor(Game game, String spriteSheetRef, int width, int height) {
		super(game);
	
		try{
			spriteSheet = new SpriteSheet(new Image(spriteSheetRef), width, height);
		} catch (SlickException e) {
			System.err.println("Failed to load spritesheet.");
			System.err.println(e);
		}
		
		animation = new Animation[8];
		
		for(int i = 0; i < animation.length; i++) {
			animation[i] = new Animation(spriteSheet, 0,i,3,i, true, 100, true);
		}
		
		action = ActorState.IDLING;
		direction = Direction.DOWN;
	}
	
	public void render() {
		animation[action.ordinal() * 4 + direction.ordinal()].draw((int)x, (int)y);
	}
}
